-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - asters #17405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Components - asters #17405
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughThis update introduces the initial implementation of the "asters" component, including foundational API client logic, prop definitions, and utility methods. It adds actions for listing labels, posts, post analytics, and social accounts, as well as a polling source for detecting when a label is added to a post. Supporting base modules and sample event data are also included. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Action
participant AstersApp
participant API
User->>Action: Trigger action (e.g., List Labels)
Action->>AstersApp: Call API client method (e.g., listLabels)
AstersApp->>API: Make HTTP request
API-->>AstersApp: Return data
AstersApp-->>Action: Return processed data
Action-->>User: Output results
sequenceDiagram
participant Source
participant AstersApp
participant API
participant EventStream
Source->>AstersApp: Fetch resources (e.g., listPosts)
AstersApp->>API: Make paginated API requests
API-->>AstersApp: Return resources
AstersApp-->>Source: Provide resource list
Source->>EventStream: Emit events for each new label
Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
components/asters/sources/common/base.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/asters/sources/new-label-added/test-event.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/asters/sources/new-label-added/new-label-added.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
🧰 Additional context used🧠 Learnings (1)components/asters/sources/new-label-added/test-event.mjs (3)⏰ Context from checks skipped due to timeout of 90000ms (4)
🔇 Additional comments (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (2)
components/asters/asters.app.mjs (1)
48-58: Consider adding error handling to _makeRequest.While the implementation is correct, consider wrapping the axios call in a try-catch block to provide better error messages for API failures.
_makeRequest({ $ = this, path, ...opts }) { - return axios($, { - url: `${this._baseUrl()}${path}`, - headers: { - "x-api-key": `${this.$auth.api_key}`, - }, - ...opts, - }); + try { + return axios($, { + url: `${this._baseUrl()}${path}`, + headers: { + "x-api-key": `${this.$auth.api_key}`, + }, + ...opts, + }); + } catch (error) { + throw new Error(`API request failed: ${error.message}`); + } }components/asters/sources/new-label-added/new-label-added.mjs (1)
35-47: Consider efficiency implications of the broad date range.The date filter from "1979-01-01" might be inefficient for workspaces with large historical datasets, potentially causing timeouts or performance issues on initial runs.
Consider implementing a more reasonable default date range or allowing users to configure the historical lookback period.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (9)
components/asters/actions/list-labels/list-labels.mjs(1 hunks)components/asters/actions/list-posts-analytics/list-posts-analytics.mjs(1 hunks)components/asters/actions/list-posts/list-posts.mjs(1 hunks)components/asters/actions/list-social-accounts/list-social-accounts.mjs(1 hunks)components/asters/asters.app.mjs(1 hunks)components/asters/package.json(2 hunks)components/asters/sources/common/base.mjs(1 hunks)components/asters/sources/new-label-added/new-label-added.mjs(1 hunks)components/asters/sources/new-label-added/test-event.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (8)
components/asters/package.json (1)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.
components/asters/actions/list-labels/list-labels.mjs (3)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
components/asters/sources/new-label-added/test-event.mjs (4)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#14265
File: components/the_magic_drip/sources/common.mjs:35-43
Timestamp: 2024-10-10T19:18:27.998Z
Learning: In `components/the_magic_drip/sources/common.mjs`, when processing items in `getAndProcessData`, `savedIds` is intentionally updated with IDs of both emitted and non-emitted items to avoid emitting retroactive events upon first deployment and ensure only new events are emitted as they occur.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#15376
File: components/monday/sources/name-updated/name-updated.mjs:6-6
Timestamp: 2025-01-23T03:55:15.166Z
Learning: Source names in Monday.com components don't need to start with "New" if they emit events for updated items (e.g., "Name Updated", "Column Value Updated") rather than new items. This follows the component guidelines exception where the "New" prefix is only required when emits are limited to new items.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-10-08T15:33:38.240Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-07-24T02:06:47.016Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
components/asters/actions/list-social-accounts/list-social-accounts.mjs (4)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: In the Salesloft API integration (components/salesloft/salesloft.app.mjs), the _makeRequest method returns response.data which directly contains arrays for list endpoints like listPeople, listCadences, listUsers, and listAccounts. The propDefinitions correctly call .map() directly on these responses without needing to destructure a nested data property.
components/asters/actions/list-posts/list-posts.mjs (2)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
components/asters/sources/new-label-added/new-label-added.mjs (4)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#15376
File: components/monday/sources/name-updated/name-updated.mjs:6-6
Timestamp: 2025-01-23T03:55:15.166Z
Learning: Source names in Monday.com components don't need to start with "New" if they emit events for updated items (e.g., "Name Updated", "Column Value Updated") rather than new items. This follows the component guidelines exception where the "New" prefix is only required when emits are limited to new items.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#14265
File: components/the_magic_drip/sources/common.mjs:35-43
Timestamp: 2024-10-10T19:18:27.998Z
Learning: In `components/the_magic_drip/sources/common.mjs`, when processing items in `getAndProcessData`, `savedIds` is intentionally updated with IDs of both emitted and non-emitted items to avoid emitting retroactive events upon first deployment and ensure only new events are emitted as they occur.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-10-08T15:33:38.240Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-07-24T02:06:47.016Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
components/asters/asters.app.mjs (3)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: In the Salesloft API integration (components/salesloft/salesloft.app.mjs), the _makeRequest method returns response.data which directly contains arrays for list endpoints like listPeople, listCadences, listUsers, and listAccounts. The propDefinitions correctly call .map() directly on these responses without needing to destructure a nested data property.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: The Salesloft API list endpoints (listPeople, listCadences, listUsers, listAccounts) return arrays directly in the response body, not wrapped in a metadata object with a nested data property. The _makeRequest method correctly returns response.data which contains the arrays that can be mapped over directly in propDefinitions.
Learnt from: js07
PR: PipedreamHQ/pipedream#17375
File: components/zerobounce/actions/get-validation-results-file/get-validation-results-file.mjs:23-27
Timestamp: 2025-07-01T17:07:48.143Z
Learning: "dir" props in Pipedream components are hidden in the component form and not user-facing, so they don't require labels or descriptions for user clarity.
components/asters/sources/common/base.mjs (3)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common.mjs:97-98
Timestamp: 2024-07-24T02:05:59.531Z
Learning: The `processTimerEvent` method in the `components/salesforce_rest_api/sources/common.mjs` file is intentionally left unimplemented to enforce that subclasses must implement this method, similar to an abstract class in object-oriented programming.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-07-24T02:06:47.016Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-10-08T15:33:38.240Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
🪛 Gitleaks (8.26.0)
components/asters/sources/new-label-added/test-event.mjs
12-12: Identified a pattern that may indicate AWS credentials, risking unauthorized cloud resource access and data breaches on AWS platforms.
(aws-access-token)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Publish TypeScript components
- GitHub Check: pnpm publish
- GitHub Check: Verify TypeScript components
- GitHub Check: Lint Code Base
🔇 Additional comments (11)
components/asters/package.json (1)
3-17: LGTM!Version bump to 0.1.0 is appropriate for the new features being added, and the @pipedream/platform dependency is correctly specified.
components/asters/asters.app.mjs (3)
1-6: LGTM!Standard Pipedream app module structure with correct axios import.
6-43: Well-structured propDefinitions!Good defensive programming with the default empty array destructuring for workspaces. The async options properly fetch and map data for dynamic dropdowns.
95-122: Verify the pagination response structure.The pagination logic assumes a specific response structure with
dataarray andpagination.totalPages. Please ensure this matches the actual API response format.Can you confirm that all paginated endpoints return responses in this format:
{ data: [...], pagination: { totalPages: number, // other pagination fields } }components/asters/actions/list-posts/list-posts.mjs (1)
39-58: LGTM!Well-implemented action with proper pagination handling and correctly formatted summary export that handles singular/plural forms.
components/asters/actions/list-labels/list-labels.mjs (1)
18-26: Ensure labels endpoint pagination
Confirm whether the Asters labels endpoint (/workspaces/{workspaceId}/labels) is paginated. If it can return more than one page of results, switch this action to usegetPaginatedResourcesfor consistency and full coverage:Suggested diff in
components/asters/actions/list-labels/list-labels.mjs:- async run({ $ }) { - const { data } = await this.asters.listLabels({ - workspaceId: this.workspaceId, - }); - $.export("$summary", `Successfully retrieved ${data.length} label${data.length === 1 ? "" : "s"}`); - return data; - }, + async run({ $ }) { + const labels = await this.asters.getPaginatedResources({ + fn: this.asters.listLabels, + args: { workspaceId: this.workspaceId }, + }); + $.export( + "$summary", + `Successfully retrieved ${labels.length} label${labels.length === 1 ? "" : "s"}` + ); + return labels; + },
- Adjust exports and return value to use
labelsinstead ofdata.- If the endpoint isn’t paginated, no changes are needed—just document that it always returns all labels.
components/asters/actions/list-social-accounts/list-social-accounts.mjs (1)
1-27: LGTM! Well-structured action following Pipedream patterns.The implementation correctly follows established Pipedream action patterns with proper prop definitions, API method invocation, and summary message formatting with singular/plural handling.
components/asters/sources/new-label-added/new-label-added.mjs (1)
48-61: LGTM! Proper event processing and metadata generation.The resource processing logic correctly iterates through labels and generates appropriate metadata for each event. The unique ID generation combining post and label IDs ensures proper deduplication.
components/asters/sources/common/base.mjs (2)
19-32: LGTM! Proper abstract class pattern implementation.The use of ConfigurationError for unimplemented abstract methods follows established Pipedream patterns and ensures subclasses implement required functionality.
33-42: LGTM! Clean implementation of paginated resource processing.The run method efficiently handles paginated resource fetching and processing using the abstract methods defined by subclasses.
components/asters/actions/list-posts-analytics/list-posts-analytics.mjs (1)
1-59: LGTM! Consistent implementation following established patterns.The action properly implements pagination handling, prop dependencies, and summary message formatting. The structure is consistent with other actions in this PR.
GTFalcao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! If there's docs for the polling endpoint though let's add them to that source's description
| ...common, | ||
| key: "asters-new-label-added", | ||
| name: "New Label Added", | ||
| description: "Emit new event when a label is added to a post.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add docs links here?
|
/approve |
Resolves #17394
Summary by CodeRabbit
New Features
Improvements
Chores